﻿// ***********************************************************************
// <copyright file="QiushibaikeHelper.cs" company="四川全球通">
// Copyright (c) 四川全球通. All rights reserved.</copyright>
// Assembly         : Tzq.DataService.Helper
// Author            : 谭志强
// Created          : 2016/1/13 11:11:46
// <summary></summary>
// ***********************************************************************

using Common.WCF;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tzq.DataService.Contract;

namespace Tzq.DataService.Helper
{
    public class QiushibaikeHelper
    {
        private static IQiushibaikeDataService client = null;

        /// <summary>
        /// 远程地址
        /// </summary>
        private static string endpointAddress = string.Empty;

        /// <summary>
        /// 构造函数
        /// </summary>
        static QiushibaikeHelper()
        {
            string configPath = System.IO.Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "WCFConfig\\QiushibaikeDataService.config");
            client = ServiceProxyFactory.Create<IQiushibaikeDataService>(configPath, "QiushibaikeDataServiceEndpoint");
            endpointAddress = ServiceProxyFactory.GetEndpointAddress<IQiushibaikeDataService>(configPath, "QiushibaikeDataServiceEndpoint");
        }

        /// <summary>
        /// 根据关键字获取笑话
        /// </summary>
        /// <param name="keywords"></param>
        /// <returns></returns>
        public static string GetJokesByKeyWordes(string keywords)
        {
            return client.GetJokesByKeyWordes(keywords);
        }

        /// <summary>
        /// 随机获取笑话
        /// </summary>
        /// <returns></returns>
        public static string GetJokesByRandom()
        {
            return client.GetJokesByRandom();
        }
    }
}
